#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time    : 2023/10/26 17:06# @Author  : zhaowp1109# @File    : oss_util.py# @Description :from app.core.config import settingsimport oss2endpoint = settings.OSS_ENDPOINTauth = oss2.Auth(settings.OSS_AccessKeyID, settings.OSS_AccessKeySecret)bucket = oss2.Bucket(auth, endpoint,settings.OSS_BUCKET)class OssUtils(object):    @classmethod    def put_obj(cls,filename,content,bucket=bucket):        #上传        bucket.put_object(filename, content)    @classmethod    def get_obj(cls,filename,bucket=bucket):        # 下载        return bucket.get_object(filename).read()    @classmethod    def delete_obj(cls,filename,bucket=bucket):        # 删除        bucket.delete_object(filename)